proc checkaccess {hand1 chan hand2} {
  set hand1lev 0
  set hand2lev 0      
if {[matchattr $hand1 |a $chan]} {
  set hand1lev 1
  }
if {[matchattr $hand1 |v $chan]} {
  set hand1lev 2
  } 	
if {[matchattr $hand1 |o $chan]} {
  set hand1lev 3
  }   
if {[matchattr $hand1 |m $chan]} {
  set hand1lev 4
  }
if {[matchattr $hand1 |n $chan]} {
  set hand1lev 5
  }
if {[matchattr $hand1 o]} {
  set hand1lev 6
  }
if {[matchattr $hand1 m]} {
  set hand1lev 7
  }
if {[matchattr $hand1 n]} {
  set hand1lev 8
  }
if {[matchattr $hand2 |a $chan]} {
  set hand2lev 1
  }     
if {[matchattr $hand2 |v $chan]} {
  set hand2lev 2
  }
if {[matchattr $hand2 |o $chan]} {
  set hand2lev 3
  }	
if {[matchattr $hand2 |m $chan]} {
  set hand2lev 4
  }
if {[matchattr $hand2 |n $chan]} {
  set hand2lev 5
  }
if {[matchattr $hand2 o]} {
  set hand2lev 6
  }
if {[matchattr $hand2 m]} {
  set hand2lev 7
  }
if {[matchattr $hand2 n]} {
  set hand2lev 8
  }
  set result [expr $hand1lev - $hand2lev]
if {$result == -1 } { return 0 }
if {$result == -2 } { return 0 }
if {$result == -3 } { return 0 }
if {$result == -4 } { return 0 }	
if {$result == -5 } { return 0 }
  return $result
  }


